package com.lhc.Homework1;

import com.sun.javafx.collections.MappingChange;

import java.util.*;

public class CountMaster {

    private  Map<String,Object> count;
    private  List<Map<String,Object>> lst;


    public CountMaster() {
        count= new HashMap<>();
        lst=new ArrayList<>();
    }

    public  void init()
    {
        Scanner sc=new Scanner(System.in);

        System.out.println("储户ID:");
        String cID=sc.next();
        System.out.println("储户姓名：");
        String cName=sc.next();
        System.out.println("储户余额：");
        double cMoney=sc.nextDouble();
        count.put("储户ID",cID);
        count.put("储户姓名",cName);
        count.put("储户余额",cMoney);
        lst.add(count);
    }

    public void printInfo()
    {
        for(int i=0;i<lst.size();i++)
        {
            Map<String,Object> map= lst.get(i);

            Set<String> set0=map.keySet();
            Iterator<String> it=set0.iterator();
            while(it.hasNext())
            {
                String str=it.next();
                System.out.print(" "+str+":"+map.get(str)+"\t");
            }
            System.out.println();
        }
    }

   /* public double searchById(String cNum)
    {
        double CM=0;
        for(int i=0;i<lst.size();i++)
        {
            Map<String,Object> map= lst.get(i);

            Set<Map.Entry<String,Object>>set=map.entrySet();

            for (Map.Entry<String,Object> entry:set)
            {
                if(entry.getKey()=="储户ID"&&entry.getValue()==cNum)
                {

                }

            }
        }
    }*/

}
